/**********************************************************************************
Program:       chinaweathergadget

License:       GNU/GPL version 3

File:          NewListBox.cs

Description:   重写的 ListBox 类

Author:        Guangyu Liu （lgy0417@gmail.com）

Environment:   .NET Framework v2.0 or later version

Usage/Example: README_chs.txt

Last Modified: 2010.08.12

***********************************************************************************/


using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.ComponentModel;
using System.Collections;
using System.Runtime.InteropServices;

namespace PrettifiedControls
{
	namespace PrettifiedListBox
	{	
		[ToolboxBitmap(typeof(ListBox))]
		public class ListBoxNew : ListBox
		{
			#region Fields

			private Color _rowBackColor1 = Color.White;
			private Color _rowBackColor2 = Color.FromArgb(254, 216, 249);
			private Color _selectedColor = Color.FromArgb(102, 206, 255);
			private Color _borderColor = Color.FromArgb(55, 126, 168);
			private ListBoxNewItemCollection _items;

			#endregion

			#region Constructors

			public ListBoxNew()
				: base()
			{
				_items = new ListBoxNewItemCollection(this);
				base.DrawMode = DrawMode.OwnerDrawFixed;
			}

			#endregion

			#region Properties

			[Localizable(true)]
			[MergableProperty(false)]
			[DesignerSerializationVisibility(
				DesignerSerializationVisibility.Content)]
			public new ListBoxNewItemCollection Items
			{
				get { return _items; }
			}

			[DefaultValue(typeof(Color),"White")]
			public Color RowBackColor1
			{
				get { return _rowBackColor1; }
				set
				{
					_rowBackColor1 = value;
					base.Invalidate();
				}
			}

			[DefaultValue(typeof(Color), "254, 216, 249")]
			public Color RowBackColor2
			{
				get { return _rowBackColor2; }
				set
				{
					_rowBackColor2 = value;
					base.Invalidate();
				}
			}

			[DefaultValue(typeof(Color), "102, 206, 255")]
			public Color SelectedColor
			{
				get { return _selectedColor; }
				set
				{
					_selectedColor = value;
					base.Invalidate();
				}
			}

			[DefaultValue(typeof(Color), "55, 126, 168")]
			public Color BorderColor
			{
				get { return _borderColor; }
				set
				{
					_borderColor = value;
					base.Invalidate(true);
				}
			}

			internal ListBox.ObjectCollection OldItems
			{
				get { return base.Items; }
			}

			private NativeMethods.RECT AbsoluteClientRECT
			{
				get
				{
					NativeMethods.RECT lpRect = new NativeMethods.RECT();
					CreateParams createParams = CreateParams;
					NativeMethods.AdjustWindowRectEx(
						ref lpRect,
						createParams.Style,
						false,
						createParams.ExStyle);
					int left = -lpRect.Left;
					int right = -lpRect.Top;
					NativeMethods.GetClientRect(
						base.Handle,
						ref lpRect);

					lpRect.Left += left;
					lpRect.Right += left;
					lpRect.Top += right;
					lpRect.Bottom += right;
					return lpRect;
				}
			}

			private Rectangle AbsoluteClientRectangle
			{
				get
				{
					NativeMethods.RECT absoluteClientRECT = AbsoluteClientRECT;

					Rectangle rect = Rectangle.FromLTRB(
						absoluteClientRECT.Left,
						absoluteClientRECT.Top,
						absoluteClientRECT.Right,
						absoluteClientRECT.Bottom);
					CreateParams cp = base.CreateParams;
					bool bHscroll = (cp.Style &
						(int)NativeMethods.WindowStyle.WS_HSCROLL) != 0;
					bool bVscroll = (cp.Style &
						(int)NativeMethods.WindowStyle.WS_VSCROLL) != 0;

					if (bHscroll)
					{
						rect.Height += SystemInformation.HorizontalScrollBarHeight;
					}

					if (bVscroll)
					{
						rect.Width += SystemInformation.VerticalScrollBarWidth;
					}

					return rect;
				}
			}

			#endregion

			#region Override Methods

			protected override void OnDrawItem(DrawItemEventArgs e)
			{
				base.OnDrawItem(e);

				if (e.Index != -1 && base.Items.Count > 0)
				{
					System.Diagnostics.Debug.WriteLine(e.State);
					Rectangle bounds = e.Bounds;
					ListBoxNewItem item = Items[e.Index];
					Graphics g = e.Graphics;

					if ((e.State & DrawItemState.Selected)
						== DrawItemState.Selected)
					{
						RenderBackgroundInternal(
							g,
							bounds,
							_selectedColor,
							_selectedColor,
							Color.FromArgb(200, 255, 255, 255),
							0.45f,
							true,
							LinearGradientMode.Vertical);
					}
					else
					{
						Color backColor;
						if (e.Index % 2 == 0)
						{
							backColor = _rowBackColor2;
						}
						else
						{
							backColor = _rowBackColor1;
						}
						using (SolidBrush brush = new SolidBrush(backColor))
						{
							g.FillRectangle(brush, bounds);
						}
					}

					Image image = item.Image;

					Rectangle imageRect = new Rectangle(
						bounds.X + 2,
						bounds.Y + 2,
						bounds.Height - 4,
						bounds.Height - 4);
					Rectangle textRect = new Rectangle(
						imageRect.Right + 2,
						bounds.Y,
						bounds.Width - imageRect.Right - 2,
						bounds.Height);

					string text = item.ToString();
					TextFormatFlags formatFlags = 
						TextFormatFlags.VerticalCenter;
					if (RightToLeft == RightToLeft.Yes)
					{
						imageRect.X = bounds.Right - imageRect.Right;
						textRect.X = bounds.Right - textRect.Right;
						formatFlags |= TextFormatFlags.RightToLeft;
						formatFlags |= TextFormatFlags.Right;
					}
					else
					{
						formatFlags |= TextFormatFlags.Left;
					}

					if (image != null)
					{
						g.InterpolationMode = 
							InterpolationMode.HighQualityBilinear;
						g.DrawImage(
							image,
							imageRect,
							0,
							0,
							image.Width,
							image.Height,
							GraphicsUnit.Pixel);
					}

					TextRenderer.DrawText(
						g,
						text,
						Font,
						textRect,
						ForeColor,
						formatFlags);

					if ((e.State & DrawItemState.Focus) ==
						DrawItemState.Focus)
					{
						e.DrawFocusRectangle();
					}
				}
			}

			protected override void WndProc(ref Message m)
			{
				switch (m.Msg)
				{
					case (int)NativeMethods.WindowsMessgae.WM_NCPAINT:
						WmNcPaint(ref m);
						break;
					default:
						base.WndProc(ref m);
						break;
				}
			}

			#endregion

			#region Windows Message Methods

			private void WmNcPaint(ref Message m)
			{
				base.WndProc(ref m);
				if (base.BorderStyle == BorderStyle.None)
				{
					return;
				}

				IntPtr hDC = NativeMethods.GetWindowDC(m.HWnd);
				if (hDC == IntPtr.Zero)
				{
					throw new Win32Exception();
				}
				try
				{
					Color backColor = BackColor;
					Color borderColor = _borderColor;

					Rectangle bounds = new Rectangle(0, 0, Width, Height);
					using (Graphics g = Graphics.FromHdc(hDC))
					{
						using (Region region = new Region(bounds))
						{
							region.Exclude(AbsoluteClientRectangle);
							using (Brush brush = new SolidBrush(backColor))
							{
								g.FillRegion(brush, region);
							}
						}

						ControlPaint.DrawBorder(
							g,
							bounds,
							borderColor,
							ButtonBorderStyle.Solid);
					}
				}
				finally
				{
					NativeMethods.ReleaseDC(m.HWnd, hDC);
				}
				m.Result = IntPtr.Zero;
			}

			#endregion

			#region Draw Help Methods

			internal void RenderBackgroundInternal(
			  Graphics g,
			  Rectangle rect,
			  Color baseColor,
			  Color borderColor,
			  Color innerBorderColor,
			  float basePosition,
			  bool drawBorder,
			  LinearGradientMode mode)
			{
				if (drawBorder)
				{
					rect.Width--;
					rect.Height--;
				}
				using (LinearGradientBrush brush = new LinearGradientBrush(
				   rect, Color.Transparent, Color.Transparent, mode))
				{
					Color[] colors = new Color[4];
					colors[0] = GetColor(baseColor, 0, 35, 24, 9);
					colors[1] = GetColor(baseColor, 0, 13, 8, 3);
					colors[2] = baseColor;
					colors[3] = GetColor(baseColor, 0, 68, 69, 54);

					ColorBlend blend = new ColorBlend();
					blend.Positions = new float[] { 0.0f, basePosition, basePosition + 0.05f, 1.0f };
					blend.Colors = colors;
					brush.InterpolationColors = blend;
					g.FillRectangle(brush, rect);
				}
				if (baseColor.A > 80)
				{
					Rectangle rectTop = rect;
					if (mode == LinearGradientMode.Vertical)
					{
						rectTop.Height = (int)(rectTop.Height * basePosition);
					}
					else
					{
						rectTop.Width = (int)(rect.Width * basePosition);
					}
					using (SolidBrush brushAlpha =
						new SolidBrush(Color.FromArgb(80, 255, 255, 255)))
					{
						g.FillRectangle(brushAlpha, rectTop);
					}
				}

				if (drawBorder)
				{
					using (Pen pen = new Pen(borderColor))
					{
						g.DrawRectangle(pen, rect);
					}

					rect.Inflate(-1, -1);
					using (Pen pen = new Pen(innerBorderColor))
					{
						g.DrawRectangle(pen, rect);
					}
				}
			}

			private Color GetColor(
				Color colorBase, int a, int r, int g, int b)
			{
				int a0 = colorBase.A;
				int r0 = colorBase.R;
				int g0 = colorBase.G;
				int b0 = colorBase.B;

				if (a + a0 > 255) { a = 255; } else { a = Math.Max(a + a0, 0); }
				if (r + r0 > 255) { r = 255; } else { r = Math.Max(r + r0, 0); }
				if (g + g0 > 255) { g = 255; } else { g = Math.Max(g + g0, 0); }
				if (b + b0 > 255) { b = 255; } else { b = Math.Max(b + b0, 0); }

				return Color.FromArgb(a, r, g, b);
			}

			#endregion
		}
		
		
		[ListBindable(false)]
		public class ListBoxNewItemCollection 
			: IList,ICollection,IEnumerable
		{
			#region Fields

			private ListBoxNew _owner;

			#endregion

			#region Constructors

			public ListBoxNewItemCollection(ListBoxNew owner)
			{
				_owner = owner;
			}

			#endregion

			#region Properties

			internal ListBoxNew Owner
			{
				get { return _owner; }
			}

			public ListBoxNewItem this[int index]
			{
				get { return Owner.OldItems[index] as ListBoxNewItem; }
				set { Owner.OldItems[index] = value; }
			}

			public int Count
			{
				get { return Owner.OldItems.Count; }
			}

			public bool IsReadOnly 
			{
				get { return Owner.OldItems.IsReadOnly; }
			}

			#endregion

			#region Public Methods

			public int Add(ListBoxNewItem item)
			{
				if (item == null)
				{
					throw new ArgumentNullException("item");
				}
				return Owner.OldItems.Add(item);
			}

			public void AddRange(ListBoxNewItemCollection value)
			{
				foreach (ListBoxNewItem item in value)
				{
					Add(item);
				}
			}

			public void AddRange(ListBoxNewItem[] items)
			{
				Owner.OldItems.AddRange(items);
			}

			public void Clear()
			{
				Owner.OldItems.Clear();
			}

			public bool Contains(ListBoxNewItem item)
			{
				return Owner.OldItems.Contains(item);
			}

			public void CopyTo(
				ListBoxNewItem[] destination, 
				int arrayIndex)
			{
				Owner.OldItems.CopyTo(destination, arrayIndex);
			}

			public int IndexOf(ListBoxNewItem item)
			{
				return Owner.OldItems.IndexOf(item);
			}

			public void Insert(int index, ListBoxNewItem item)
			{
				if (item == null)
				{
					throw new ArgumentNullException("item");
				}
				Owner.OldItems.Insert(index, item);
			}

			public void Remove(ListBoxNewItem item)
			{
				Owner.OldItems.Remove(item);
			}

			public void RemoveAt(int index)
			{
				Owner.OldItems.RemoveAt(index);
			}

			public IEnumerator GetEnumerator()
			{
				return Owner.OldItems.GetEnumerator();
			}

			#endregion

			#region IList 成员

			int IList.Add(object value)
			{
				if (!(value is ListBoxNewItem))
				{
					throw new ArgumentException();
				}
				return Add(value as ListBoxNewItem);
			}

			void IList.Clear()
			{
				Clear();
			}

			bool IList.Contains(object value)
			{
				return Contains(value as ListBoxNewItem);
			}

			int IList.IndexOf(object value)
			{
				return IndexOf(value as ListBoxNewItem);
			}

			void IList.Insert(int index, object value)
			{
				if (!(value is ListBoxNewItem))
				{
					throw new ArgumentException();
				}
				Insert(index, value as ListBoxNewItem);
			}

			bool IList.IsFixedSize
			{
				get { return false; }
			}

			bool IList.IsReadOnly
			{
				get { return IsReadOnly; }
			}

			void IList.Remove(object value)
			{
				Remove(value as ListBoxNewItem);
			}

			void IList.RemoveAt(int index)
			{
				RemoveAt(index);
			}

			object IList.this[int index]
			{
				get
				{
					return this[index];
				}
				set
				{
					if (!(value is ListBoxNewItem))
					{
						throw new ArgumentException();
					}
					this[index] = value as ListBoxNewItem;
				}
			}

			#endregion

			#region ICollection 成员

			void ICollection.CopyTo(Array array, int index)
			{
				CopyTo((ListBoxNewItem[])array, index);
			}

			int ICollection.Count
			{
				get { return Count; }
			}

			bool ICollection.IsSynchronized
			{
				get { return false; }
			}

			object ICollection.SyncRoot
			{
				get { return this; }
			}

			#endregion

			#region IEnumerable 成员

			IEnumerator IEnumerable.GetEnumerator()
			{
				return GetEnumerator();
			}

			#endregion
		}
		
		
		[Serializable]
		[TypeConverter(typeof(ExpandableObjectConverter))]
		public class ListBoxNewItem : IDisposable
		{
			#region Fields

			private string _text = "ListBoxNewItem";
			private Image _image;
			private object _tag;

			#endregion

			#region Constructors

			public ListBoxNewItem()
			{
			}

			public ListBoxNewItem(string text)
				: this(text, null)
			{
			}

			public ListBoxNewItem(string text, Image image)
			{
				_text = text;
				_image = image;
			}

			#endregion

			#region Properties

			[DefaultValue("ImageComboBoxItem")]
			[Localizable(true)]
			public string Text
			{
				get { return _text; }
				set { _text = value; }
			}

			[DefaultValue(typeof(Image), "null")]
			public Image Image
			{
				get { return _image; }
				set { _image = value; }
			}

			[Bindable(true)]
			[Localizable(false)]
			[DefaultValue("")]
			[TypeConverter(typeof(StringConverter))]
			[DesignerSerializationVisibility(
				DesignerSerializationVisibility.Hidden)]
			public object Tag
			{
				get { return _tag; }
				set { _tag = value; }
			}

			#endregion

			#region Override Methods

			public override string ToString()
			{
				return _text;
			}

			#endregion

			#region IDisposable 成员

			public void Dispose()
			{
				_image = null;
				_tag = null;
			}

			#endregion
		}
		
		
		internal class NativeMethods
		{
			[DllImport("user32.dll")]
			public static extern int SendMessage(
				IntPtr hWnd, int Msg, int wParam, int lParam);

			[DllImport("user32.dll")]
			public static extern IntPtr SendMessage(
				IntPtr hwnd, int msg, int wParam, ref HDITEM lParam);

			[DllImport("user32.dll")]
			public static extern IntPtr SendMessage(
				IntPtr hwnd, int msg, int wParam, ref RECT lParam);

			[DllImport("user32.dll")]
			[return: MarshalAs(UnmanagedType.Bool)]
			public static extern bool GetWindowRect(IntPtr hWnd, ref RECT lpRect);

			[DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true)]
			public static extern bool GetClientRect(IntPtr hWnd, ref RECT rect);

			[DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true)]
			public static extern bool AdjustWindowRectEx(
				ref RECT lpRect, int dwStyle, bool bMenu, int dwExStyle);

			[DllImport("user32.dll")]
			public static extern IntPtr GetDC(IntPtr handle);

			[DllImport("user32", CharSet = CharSet.Ansi,
				SetLastError = true, ExactSpelling = true)]
			public static extern IntPtr GetWindowDC(IntPtr hwnd);

			[DllImport("user32.dll")]
			public static extern int ReleaseDC(IntPtr handle, IntPtr hdc);

			[DllImport("user32.dll")]
			public static extern int OffsetRect(ref RECT lpRect, int x, int y);

			[DllImport("user32.dll")]
			public static extern bool ValidateRect(IntPtr hWnd, ref RECT lpRect);

			[DllImport("comctl32.dll", SetLastError = true)]
			public static extern IntPtr ImageList_GetIcon(
				IntPtr himl, int i, int flags);

			[DllImport("comctl32.dll", SetLastError = true)]
			public static extern bool ImageList_DrawEx(
				IntPtr himl,
				int i,
				IntPtr hdcDst,
				int x,
				int y,
				int dx,
				int dy,
				uint rgbBk,
				uint rgbFg,
				int fStyle);

			[DllImport("user32.dll", SetLastError = true)]
			public static extern bool DestroyIcon(IntPtr hIcon);

			[StructLayout(LayoutKind.Sequential)]
			public struct HDITEM
			{
				public int mask;
				public int cxy;
				public string pszText;
				public IntPtr hbm;
				public int cchTextMax;
				public int fmt;
				public IntPtr lParam;
				public int iImage;
				public int iOrder;
				public uint type;
				public IntPtr pvFilter;
			}

			[StructLayout(LayoutKind.Sequential)]
			public struct RECT
			{
				public int Left;
				public int Top;
				public int Right;
				public int Bottom;

				public RECT(int left, int top, int right, int bottom)
				{
					Left = left;
					Top = top;
					Right = right;
					Bottom = bottom;
				}

				public RECT(Rectangle rect)
				{
					Left = rect.Left;
					Top = rect.Top;
					Right = rect.Right;
					Bottom = rect.Bottom;
				}

				public Rectangle Rect
				{
					get
					{
						return new Rectangle(
							Left,
							Top,
							Right - Left,
							Bottom - Top);
					}
				}

				public Size Size
				{
					get
					{
						return new Size(Right - Left, Bottom - Top);
					}
				}

				public static RECT FromXYWH(int x, int y, int width, int height)
				{
					return new RECT(x,
									y,
									x + width,
									y + height);
				}

				public static RECT FromRectangle(Rectangle rect)
				{
					return new RECT(rect.Left,
									 rect.Top,
									 rect.Right,
									 rect.Bottom);
				}
			}

			public enum WindowsMessgae
			{
				WM_NULL = 0x0000,
				WM_CREATE = 0x0001,
				WM_DESTROY = 0x0002,
				WM_MOVE = 0x0003,
				WM_SIZE = 0x0005,
				WM_ACTIVATE = 0x0006,
				WM_SETFOCUS = 0x0007,
				WM_KILLFOCUS = 0x0008,
				WM_ENABLE = 0x000A,
				WM_SETREDRAW = 0x000B,
				WM_SETTEXT = 0x000C,
				WM_GETTEXT = 0x000D,
				WM_GETTEXTLENGTH = 0x000E,
				WM_PAINT = 0x000F,
				WM_CLOSE = 0x0010,

				WM_QUIT = 0x0012,
				WM_ERASEBKGND = 0x0014,
				WM_SYSCOLORCHANGE = 0x0015,
				WM_SHOWWINDOW = 0x0018,

				WM_ACTIVATEAPP = 0x001C,

				WM_SETCURSOR = 0x0020,
				WM_MOUSEACTIVATE = 0x0021,
				WM_GETMINMAXINFO = 0x24,

				WM_SETFONT = 0x30,

				WM_WINDOWPOSCHANGING = 0x0046,
				WM_WINDOWPOSCHANGED = 0x0047,

				WM_CONTEXTMENU = 0x007B,
				WM_STYLECHANGING = 0x007C,
				WM_STYLECHANGED = 0x007D,
				WM_DISPLAYCHANGE = 0x007E,
				WM_GETICON = 0x007F,
				WM_SETICON = 0x0080,

				// non client area
				WM_NCCREATE = 0x0081,
				WM_NCDESTROY = 0x0082,
				WM_NCCALCSIZE = 0x0083,
				WM_NCHITTEST = 0x84,
				WM_NCPAINT = 0x0085,
				WM_NCACTIVATE = 0x0086,

				WM_GETDLGCODE = 0x0087,

				WM_SYNCPAINT = 0x0088,

				// non client mouse
				WM_NCMOUSEMOVE = 0x00A0,
				WM_NCLBUTTONDOWN = 0x00A1,
				WM_NCLBUTTONUP = 0x00A2,
				WM_NCLBUTTONDBLCLK = 0x00A3,
				WM_NCRBUTTONDOWN = 0x00A4,
				WM_NCRBUTTONUP = 0x00A5,
				WM_NCRBUTTONDBLCLK = 0x00A6,
				WM_NCMBUTTONDOWN = 0x00A7,
				WM_NCMBUTTONUP = 0x00A8,
				WM_NCMBUTTONDBLCLK = 0x00A9,

				// keyboard
				WM_KEYDOWN = 0x0100,
				WM_KEYUP = 0x0101,
				WM_CHAR = 0x0102,

				WM_SYSCOMMAND = 0x0112,

				WM_HSCROLL = 0x0114,
				WM_VSCROLL = 0x0115,

				// menu
				WM_INITMENU = 0x0116,
				WM_INITMENUPOPUP = 0x0117,
				WM_MENUSELECT = 0x011F,
				WM_MENUCHAR = 0x0120,
				WM_ENTERIDLE = 0x0121,
				WM_MENURBUTTONUP = 0x0122,
				WM_MENUDRAG = 0x0123,
				WM_MENUGETOBJECT = 0x0124,
				WM_UNINITMENUPOPUP = 0x0125,
				WM_MENUCOMMAND = 0x0126,

				WM_CHANGEUISTATE = 0x0127,
				WM_UPDATEUISTATE = 0x0128,
				WM_QUERYUISTATE = 0x0129,

				// mouse
				WM_MOUSEFIRST = 0x0200,
				WM_MOUSEMOVE = 0x0200,
				WM_LBUTTONDOWN = 0x0201,
				WM_LBUTTONUP = 0x0202,
				WM_LBUTTONDBLCLK = 0x0203,
				WM_RBUTTONDOWN = 0x0204,
				WM_RBUTTONUP = 0x0205,
				WM_RBUTTONDBLCLK = 0x0206,
				WM_MBUTTONDOWN = 0x0207,
				WM_MBUTTONUP = 0x0208,
				WM_MBUTTONDBLCLK = 0x0209,
				WM_MOUSEWHEEL = 0x020A,
				WM_MOUSELAST = 0x020D,

				WM_PARENTNOTIFY = 0x0210,
				WM_ENTERMENULOOP = 0x0211,
				WM_EXITMENULOOP = 0x0212,

				WM_NEXTMENU = 0x0213,
				WM_SIZING = 0x0214,
				WM_CAPTURECHANGED = 0x0215,
				WM_MOVING = 0x0216,

				WM_MDIACTIVATE = 0x0222,

				WM_ENTERSIZEMOVE = 0x0231,
				WM_EXITSIZEMOVE = 0x0232,

				WM_MOUSELEAVE = 0x02A3,
				WM_MOUSEHOVER = 0x02A1,
				WM_NCMOUSEHOVER = 0x02A0,
				WM_NCMOUSELEAVE = 0x02A2,

				WM_PASTE = 0X302,

				WM_PRINT = 0x0317,
				WM_PRINTCLIENT = 0x0318,

				WM_THEMECHANGED = 0x31A,
			}

			[Flags]
			public enum WindowStyle : int
			{
				WS_OVERLAPPED = 0x00000000,
				WS_POPUP = unchecked((int)0x80000000),
				WS_CHILD = 0x40000000,
				WS_MINIMIZE = 0x20000000,
				WS_VISIBLE = 0x10000000,
				WS_DISABLED = 0x08000000,
				WS_CLIPSIBLINGS = 0x04000000,
				WS_CLIPCHILDREN = 0x02000000,
				WS_MAXIMIZE = 0x01000000,
				WS_CAPTION = 0x00C00000,
				WS_BORDER = 0x00800000,
				WS_DLGFRAME = 0x00400000,
				WS_VSCROLL = 0x00200000,
				WS_HSCROLL = 0x00100000,
				WS_SYSMENU = 0x00080000,
				WS_THICKFRAME = 0x00040000,
				WS_GROUP = 0x00020000,
				WS_TABSTOP = 0x00010000,
				WS_MINIMIZEBOX = 0x00020000,
				WS_MAXIMIZEBOX = 0x00010000,
				WS_TILED = WS_OVERLAPPED,
				WS_ICONIC = WS_MINIMIZE,
				WS_SIZEBOX = WS_THICKFRAME,
				WS_TILEDWINDOW = WS_OVERLAPPEDWINDOW,
				WS_OVERLAPPEDWINDOW = (WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU |
										WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX),
				WS_POPUPWINDOW = (WS_POPUP | WS_BORDER | WS_SYSMENU),
				WS_CHILDWINDOW = (WS_CHILD)
			}

			[Flags]
			public enum ImageListDrawFlags : int
			{
				ILD_NORMAL = 0x00000000,
				ILD_TRANSPARENT = 0x00000001,
				ILD_BLEND25 = 0x00000002,
				ILD_FOCUS = 0x00000002,
				ILD_BLEND50 = 0x00000004,
				ILD_SELECTED = 0x00000004,
				ILD_BLEND = 0x00000004,
				ILD_MASK = 0x00000010,
				ILD_IMAGE = 0x00000020,
				ILD_ROP = 0x00000040,
				ILD_OVERLAYMASK = 0x00000F00,
				ILD_PRESERVEALPHA = 0x00001000,
				ILD_SCALE = 0x00002000,
				ILD_DPISCALE = 0x00004000,
				ILD_ASYNC = 0x00008000
			}

			public enum ImageListColorFlags : uint
			{
				CLR_NONE = 0xFFFFFFFF,
				CLR_DEFAULT = 0xFF000000,
				CLR_HILIGHT = CLR_DEFAULT,
			}
		}
	}
}


namespace PrettifiedListBox.Properties {
    using System;
    
    
    /// <summary>
    ///   强类型资源类，用于查找本地化字符串等。
    /// </summary>
    // 此类是由 StronglyTypedResourceBuilder
    // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
    // 若要添加或移除成员，请编辑 .ResX 文件，然后重新运行 ResGen
    // (以 /str 作为命令选项)，或重新生成 VS 项目。
    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")]
    [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
    internal class Resources {
        
        private static global::System.Resources.ResourceManager resourceMan;
        
        private static global::System.Globalization.CultureInfo resourceCulture;
        
        [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
        internal Resources() {
        }
        
        /// <summary>
        ///   返回此类使用的缓存 ResourceManager 实例。
        /// </summary>
        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
        internal static global::System.Resources.ResourceManager ResourceManager {
            get {
                if (object.ReferenceEquals(resourceMan, null)) {
                    global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("PrettifiedListBox.Properties.Resources", typeof(Resources).Assembly);
                    resourceMan = temp;
                }
                return resourceMan;
            }
        }
        
        /// <summary>
        ///   为使用此强类型资源类的所有资源查找
        ///   重写当前线程的 CurrentUICulture 属性。
        /// </summary>
        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
        internal static global::System.Globalization.CultureInfo Culture {
            get {
                return resourceCulture;
            }
            set {
                resourceCulture = value;
            }
        }
    }
}




namespace PrettifiedListBox.Properties {
    
    
    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "8.0.0.0")]
    internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
        
        private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
        
        public static Settings Default {
            get {
                return defaultInstance;
            }
        }
    }
}




/* 作者：Starts_2000
      * 日期：2009-11-16
      * 网站：http://www.csharpwin.com CS 程序员之窗。
      * 你可以免费使用或修改以下代码，但请保留版权信息。
      * 具体请查看 CS程序员之窗开源协议（http://www.csharpwin.com/csol.html）。
*/
